package cn.math.appmath.biz.impl;

import java.util.ArrayList;
import java.util.List;

import cn.math.appmath.bean.ProjectBean;
import cn.math.appmath.biz.ProjectBiz;
import cn.math.appmath.dao.ProjectDao;
import cn.math.appmath.entity.Project;

public class ProjectBizImpl implements ProjectBiz {
	private ProjectDao projectDao;
	
	public ProjectBean query(int page, String param, String sqlStr, ArrayList<Object> objectList){
		if(sqlStr.equals(""))
			if(param.equals("forward")){
				page = page - 2;
			}
		return this.projectDao.queryProjects(page, sqlStr, objectList);
	}
	
	public boolean delete(Integer[] ids) {
		return this.projectDao.batchDelete(ids);
	}

	public List<Project> findAll() {
		// TODO Auto-generated method stub
		return null;
	}

	public Project findById(Integer id) {
		return this.projectDao.findById(id);
	}

	public boolean save(Project project) {
		try{
			this.projectDao.save(project);
			return true;
		}catch(Exception ex){
			return false;
		}
	}

	public void update(Project project) {
		// TODO Auto-generated method stub

	}

	public void setProjectDao(ProjectDao projectDao) {
		this.projectDao = projectDao;
	}

}
